<template>
  
    <div class="mui-numbox" data-numbox-step="1" data-numbox-min="1">
      <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
      <input class="mui-numbox-input" type="number" :value="initCount" @change="amountChange" ref="numBox">
      <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
  
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {
  data() {
    return {

    };
  },
  methods: {
    amountChange(){
      //数量改变触发
    //   console.log(this.$refs.numBox.value)
    //数量发生改变获取当前商品的 id和 数量 当做参数传递给方法xxx
        this.$store.commit("updataGoodsCount",{
            id:this.goodsid,
            mount:this.$refs.numBox.value
        });
    }
  },
  mounted(){
      //初始化数字选择框
      mui('.mui-numbox').numbox();
      console.log(this.max)
  },
  
  watch:{
    //属性监听
    
  },
  props:['initCount','goodsid'],
};
</script>
<style lang="scss" scoped>

</style>
